<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  
  <body>
    <h1>用户列表</h1>
    <div><a href="user_add">添加新用户</a></div>
    <table border="1" cellpadding="0" cellspacing="0">
    	<tr>
    		<th>编号</th>
    		<th>姓名</th>
    		<th>年龄</th>
    		<th>分组</th>
    		<th>操作</th>
    	</tr>
    	<c:choose>
    		<c:when test="${empty users}">
    			<tr><td colspan="5"><li>没有相关数据</li></td></tr>
    		</c:when>
    		<c:otherwise>
    			<c:forEach items="${users}" var="user">
    				<tr>
    					<td>${user.id}</td>
    					<td>${user.name }</td>
    					<td>${user.age }</td>
    					<td>${user.group.name}</td>
    					<td>
    					<a href="user_del?uid=${user.id}">删除</a>
    					|
    					<a href="user_load?uid=${user.id}">修改</a>
    					</td> 
    				</tr>
    			</c:forEach>
    		</c:otherwise>
    	</c:choose>
    </table>
  </body>
</html>